// JavaScript Document
$(document).ready(function(){
		run_li('slide','next','pre');		   
		function run_li(id_ul,id_next,id_pre)	
		{
			var i = $("#"+id_ul+" >li").length;
			var width_li = parseFloat($("#"+id_ul+">li").eq(0).css('width'));
			var place = 0;
			$('#'+id_ul).css('width',(width_li*i)+'px');
			$('#'+id_next).click(function(){
				if(place < (i-1))
				{
					$('#'+id_ul).animate({
						left:'-='+width_li
					},1000);
					place ++;
				} else {
					$('#'+id_ul).animate({
						left:"0px"
					},1000);
					place = 0;
				}	
			});
			$('#'+id_pre).click(function(){
				if(place > 0)
				{
					$('#'+id_ul).animate({
						left:'+='+width_li
					},1000);
					place --;
				} else {
					var slide_width = parseFloat($('#'+id_ul).css('width')) - width_li;
					$('#'+id_ul).animate({
						left: -slide_width+'px'
					},1000);
					place = i-1;
				}	
			});
		}
});